<template>
    <div>
        <component v-for="(formitem) in list"
        :key="formitem.field"
        :is="formitem.type"
        @change="changeF($event, formitem.field)"
        :formModel="model" :field="formitem.field" :type="formitem.type"></component>
        <div class="height:200px;overflow-y:scroll;">
          <div v-for="(it,i) in 1000" :key="i">
            <a-input style="width:100px;" />
          </div>
        </div>

    </div>
</template>

<script>
import inputWiget from './inputWiget.vue';
import selectWiget from './selectWiget.vue';
import textareaWiget from './textareaWiget.vue';
    export default {
        components:{
            inputWiget,selectWiget,textareaWiget
        },
        props:{
            list:{
                type:Array,
                default:()=>{
                    return []
                }
            },
            model:{
                type:Object,
                default:()=>{
                    return {}
                }
            }
        },
        data(){
            return {

            }
        },
        beforeDestroy() {
            // 清理所有的事件监听器
            this.$off();
        },
        methods:{
            changeF(v,item){
                this.$emit('change',{
                    field: item,
                    value: v
                })
            },
        }
    }
</script>

<style  scoped>

</style>
